/**
 * 导航模块
 */
(function(window, angular, undefined){
	var module = angular.module('water.apps.sw.bdPlcControl.bdPlcDetailNav', []);
	
	module.controller('bdPlcDetailNavController',function($state,$rootScope,$scope){
		$scope.data;
		$scope.curUI;
			
		//切换模块
		$scope.toggle=function(ui){
			var data = $scope.data;
			$state.go(ui,{data:data});
	    };

		$scope.$on('$stateChangeSuccess',
	            function(event, toState, toParams, fromState, fromParams){
					$scope.curUI = toState.name;
			 	}
			 );
		
		/**
		 * 监听地图模块详情点击
		 */
		$scope.onPlcDataChanged = $scope.$on('plcDataChanged', function(event, data) {
            $scope.data = data;
            //默认进入模块为详情信息
			if(data.TITLE == "SYSTEM"){
                $state.go("bdPlcControl.systemDetail",{data:data});
			}
			else{
                $state.go("bdPlcControl.deviceDetail",{data:data});
			}
	    });
	});
}(window, angular));	